<?php

/** 
* 
* 
* by:南宁火蝶科技有限公司 http:///www.HdsysCms.com
* 声明:本系统禁止用二次开发、侵犯HdsysCms著作和除去HdsysCms进行售卖,如发现将追究一切权利,模版制作属于自己所得可以通过本系统对外开发模版获取收益!
* 
* 2019年第一版本发布 - 到2023.9.1开源使用! 
* php混淆工具:phpencry.wbox.top
* 
* 注意防骗:@HdsysCms 官方没授权任何个人机构合作,唯一收款抬头:《南宁火蝶科技有限公司》和官网显示客服唯一渠道客服,其它渠道以HdsysCms名义行为均骗子!
*
*/
	

defined('HDSYS_SET') or die("" . 'Not,This File Not Can in Ie Open');
function intelligence_spider()
{
$param_db=bs_lib::load_libhdsys_class('db');
if (bs_lib::get_configs_value('spider', 'switch')==1) {
$param_ua=bs_lib::get_configs_value('spider', 'list');
$param_http_ua=$_SERVER['HTTP_USER_AGENT'];
$param_ua .="@";
$param_ua=call_my_str_replace("|@", '', $param_ua);
$param_ua=call_my_str_replace("@", '', $param_ua);
if (preg_match("/{$param_ua}/i", $param_http_ua, $param_matches)) {
$param_type=$param_matches[0];
$param_ip=getip();
$param_url=getsysurl() . '#';
$param_url=call_my_str_replace("/#", '', $param_url);
$param_url=call_my_str_replace("#", '', $param_url);
$param_url=$param_url . $_SERVER['REQUEST_URI'];
$param_date=time();
$param_sql="INSERT INTO `hdsys_spider_visit` (`id`, `url`, `ip`, `date`, `type`, `ua`) VALUES (NULL, '{$param_url}', '{$param_ip}', '{$param_date}', '{$param_type}', '{$param_http_ua}');";
$param_db->intelligence_query($param_sql);
$param_name=$param_type;
$param_date=date('Y-m-d');
$param_val=1;
$param_sql="SELECT * FROM `hdsys_spider_statistics` WHERE `name`='{$param_name}' and `date`='{$param_date}' ;";
$param_spider_statistics=$param_db->intelligence_array($param_sql);
if ($param_spider_statistics) {
$param_sql="UPDATE `hdsys_spider_statistics` SET `val`=`val` + 1 WHERE `hdsys_spider_statistics`.`id`='{$param_spider_statistics['id']}' ;";
$param_db->intelligence_query($param_sql);
} else {
$param_sql="INSERT INTO `hdsys_spider_statistics` (`id`, `name`, `date`, `val`) VALUES (NULL, '{$param_name}', '{$param_date}', '{$param_val}');";
$param_db->intelligence_query($param_sql);
}
}
}
}
function call_my_die($param_CALL_A)
{
die($param_CALL_A);
}
function call_my_strpos($param_CALL_A, $param_CALL_B)
{
return (strpos($param_CALL_A, $param_CALL_B));
}
function call_my_strlen($param_CALL_A)
{
return (strlen($param_CALL_A));
}
function call_my_substr_replace($param_CALL_A, $param_CALL_B, $param_cALL_C, $param_cALL_D)
{
return (substr_replace($param_CALL_A, $param_CALL_B, $param_cALL_C, $param_cALL_D));
}
function call_my_str_replace($param_CALL_A, $param_CALL_B, $param_cALL_C)
{
return (str_replace($param_CALL_A, $param_CALL_B, $param_cALL_C));
}
function call_my_preg_match($param_CALL_A, $param_CALL_B)
{
return preg_match($param_CALL_A, $param_CALL_B);
}
function call_my_urlencode($param_CALL_A)
{
return urlencode($param_CALL_A);
}
function getstatic_url($param_ini)
{
$param_check_list=array(
'q',
'w',
'e',
'r',
't',
'y',
'u',
'i',
'o',
'p',
'l',
's',
'd',
'f',
'g',
'h',
'j',
'k',
'z',
'z',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'0',
);
$param_test='';
$param_ki=0;
while ($param_ki < $param_ini) {
shuffle($param_check_list);
$param_test .=$param_check_list[0];
$param_ki++;
}
return $param_test;
}
function set_static_url($param_CALL_A='content')
{
$param_db=bs_lib::load_libhdsys_class("" . 'db');
$param_static_url=getstatic_url(8);
$param_sql="SELECT `id`,`static_url` FROM `hdsys_content` WHERE `static_url`='{$param_static_url}' ";
$param_userarr=$param_db->intelligence_array($param_sql);
if ($param_userarr) {
return set_static_url($param_CALL_A);
} else {
return $param_static_url;
}
}
function my_static_url($param_CALL_A, $param_CALL_B=0)
{
$param_db=bs_lib::load_libhdsys_class("" . 'db');
if ($param_CALL_A !='' and $param_CALL_B==0) {
$param_sql="SELECT * FROM `hdsys_list` WHERE `static_url`='{$param_CALL_A}' ";
$param_userarr=$param_db->intelligence_array($param_sql);
if ($param_userarr) {
return true;
}
} else {
if ($param_CALL_A !='') {
$param_sql="SELECT * FROM `hdsys_list` WHERE id!='{$param_CALL_B}' and `static_url`='{$param_CALL_A}' ";
$param_userarr=$param_db->intelligence_array($param_sql);
if ($param_userarr) {
return true;
}
}
}
if ($param_CALL_A !='' and $param_CALL_B==0) {
$param_sql="SELECT * FROM `hdsys_content` WHERE `static_url`='{$param_CALL_A}' ";
$param_userarr=$param_db->intelligence_array($param_sql);
if ($param_userarr) {
return true;
}
} else {
if ($param_CALL_A !='') {
$param_sql="SELECT * FROM `hdsys_content` WHERE id!='{$param_CALL_B}' and `static_url`='{$param_CALL_A}' ";
$param_userarr=$param_db->intelligence_array($param_sql);
if ($param_userarr) {
return true;
}
}
}
return false;
}
function call_my_md5($param_CALL_A)
{
return md5($param_CALL_A);
}
function call_my_explode($param_CALL_A, $param_CALL_B)
{
return explode($param_CALL_A, $param_CALL_B);
}
function call_my_count($param_CALL_A)
{
return count($param_CALL_A);
}
function call_my_strtolower($param_CALL_A)
{
return strtolower($param_CALL_A);
}
function call_my_time()
{
return time();
}
function call_my_is_exists($param_CALL_A)
{
return is_exists($param_CALL_A);
}
function call_my_print($param_CALL_A)
{
return print($param_CALL_A);
}
function call_my_header($param_CALL_A)
{
header($param_CALL_A);
}
function call_my_http_build_query($param_CALL_A, $param_CALL_B, $CALL_C)
{
return http_build_query($param_CALL_A, $param_CALL_B, $CALL_C);
}
function call_my_ini_set($param_CALL_A, $param_CALL_B)
{
return ini_set($param_CALL_A, $param_CALL_B);
}
function call_my_date($param_CALL_A, $param_CALL_B)
{
return date($param_CALL_A, $param_CALL_B);
}
function call_my_json_encode($param_CALL_A, $param_CALL_B)
{
return json_encode($param_CALL_A, $param_CALL_B);
}
function call_my_file_get_contents($param_CALL_A, $param_CALL_B, $CALL_C)
{
ini_set('max_execution_time', '300');
$param_basename=basename($param_CALL_A);
$param_basename_new=call_my_str_replace(':', '_', $param_basename);
$param_CALL_A=call_my_str_replace($param_basename, $param_basename_new, $param_CALL_A);
$param_CALL_A=call_my_str_replace('_/', ':/', $param_CALL_A);
$param_CALL_A=call_my_str_replace('\_', ':/', $param_CALL_A);
return file_get_contents($param_CALL_A, $param_CALL_B, $CALL_C);
}
function call_my_file_exists($param_CALL_A)
{
$param_CALL_A=call_my_str_replace(':', '_', $param_CALL_A);
$param_basename=basename($param_CALL_A);
$param_basename_new=call_my_str_replace(':', '_', $param_basename);
$param_CALL_A=call_my_str_replace($param_basename, $param_basename_new, $param_CALL_A);
$param_CALL_A=call_my_str_replace('_/', ':/', $param_CALL_A);
$param_CALL_A=call_my_str_replace('\_', ':/', $param_CALL_A);
return file_exists($param_CALL_A);
}
function call_my_file_put_contents($param_CALL_A, $param_CALL_B)
{
$param_basename=basename($param_CALL_A);
$param_basename_new=call_my_str_replace(':', '_', $param_basename);
$param_CALL_A=call_my_str_replace($param_basename, $param_basename_new, $param_CALL_A);
$param_CALL_A=call_my_str_replace('_/', ':/', $param_CALL_A);
$param_CALL_A=call_my_str_replace('_\\', ':\\', $param_CALL_A);
return file_put_contents($param_CALL_A, $param_CALL_B);
}
function call_my_trim($param_CALL_A)
{
return trim($param_CALL_A);
}
function call_my_stream_context_create($param_CALL_A)
{
return stream_context_create($param_CALL_A);
}
function call_my_strstr($param_CALL_A, $param_CALL_B)
{
return strstr($param_CALL_A, $param_CALL_B);
}
function call_my_stripos($param_CALL_A, $param_CALL_B)
{
return stripos($param_CALL_A, $param_CALL_B);
}
function call_my_strtotime($param_CALL_A)
{
return strtotime($param_CALL_A);
}
function call_my_intval($param_CALL_A)
{
return intval($param_CALL_A);
}
function call_my_int_0()
{
return "" . "0";
}
function call_my_int_1()
{
return "" . "1";
}
function call_my_int_neg1()
{
return "" . "-1";
}
function call_my_int_aeg1()
{
return "" . "-1";
}
function call_my_str_data()
{
return "" . 'data';
}
function call_my_str_code()
{
return "" . 'code';
}
function call_my_str_msg()
{
return "" . 'msg';
}
function call_my_str_count()
{
return "" . 'count';
}
function call_my_error1()
{
error_reporting(E_ALL ^ E_NOTICE);
}
function call_my_error2()
{
error_reporting(E_ALL ^ E_NOTICE);
}
function call_my_error3()
{
ini_set("" . "display_errors", "" . "Off");
}
function call_my_ResizeImage($data, $param_newwidth=0, $param_type='jpg')
{
$uploadfile=imagecreatefromstring($data);
$width=imagesx($uploadfile);
$height=imagesy($uploadfile);
ob_start();
if ($param_newwidth > 0 and $width > $param_newwidth) {
$i=$param_newwidth / $width;
} else {
$i=1;
}
$newwidth=$width * $i;
$newheight=$height * $i;
if (function_exists("imagecopyresampled")) {
$uploaddir_resize=imagecreatetruecolor($newwidth, $newheight);
imagealphablending($uploaddir_resize, true);
imagesavealpha($uploaddir_resize, true);
$trans_colour=imagecolorallocatealpha($uploaddir_resize, 0, 0, 0, 127);
imagefill($uploaddir_resize, 0, 0, $trans_colour);
imagecopyresampled($uploaddir_resize, $uploadfile, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
} else {
$uploaddir_resize=imagecreate($newwidth, $newheight);
$uploaddir_resize=imagecreatetruecolor($newwidth, $newheight);
imagecopyresized($uploaddir_resize, $uploadfile, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
}
if ($param_type=='png') {
imagepng($uploaddir_resize, null, 9);
} else {
imagejpeg($uploaddir_resize, null, 90);
}
$imageCode=ob_get_contents();
ob_end_clean();
imagedestroy($uploaddir_resize);
imagedestroy($uploadfile);
return $imageCode=='' ? $data : $imageCode;
}
function Form_get_content($param_id,$type)
{
if ($param_id=='') {
return (array(call_my_str_code()=> call_my_int_1(), call_my_str_msg()=> 'ID错误 '));
}
$param_id=call_my_str_replace('/', '', $param_id);
$param_id=call_my_str_replace('\\', '', $param_id);
$param_id=call_my_str_replace('..', '', $param_id);
$param_dir=HDSYS_DIR_SYS . 'templates/' . $param_id  . '/modular';
if (!is_dir($param_dir)) {
return (array(call_my_str_code()=> call_my_int_1(), call_my_str_msg()=> '目录不存在 ' . 'templates/' . $param_id  . '/modular'));
}
$param_dir_list=glob($param_dir . '/'.'*.form.php');
$showinfo='';
$param_while_array_list_all=[];
$param_tmp_rows=0;
$param_dir=HDSYS_DIR_SYS . 'templates/' . $param_id  . '/modular';
sort($param_dir_list);
foreach ($param_dir_list as $param_file) {
$param_file_show=str_replace($param_dir . '/', '', $param_file);
if (is_file($param_file)) {
$param_tmp_rows++;
$param_filetxt=file_get_contents($param_file);
if (stripos($param_filetxt, '"modules"') > 0) {
$param_arr=json_decode($param_filetxt, 1);
if ($param_arr !=false) {
$param_arrtmp=array();
foreach ($param_arr as $param_v) {
if (isset($param_v['id'])) {
if (isset($param_v['relation']) and stripos(",,,,".$param_v['relation'], $type) > 0) {
if (!isset($param_arrtmp[$param_v['name']])) {
$param_arrtmp[$param_v['name']]=1;
$param_while_array_list_all[]=$param_v;
}
}
}
}
}
}
}
}
return  $param_while_array_list_all;
}
